package main

import (
	"github.com/go-playground/validator/v10"
	"regexp"
)

type Person struct {
	Name  string `validate:"min=1,max=10"`
	Age   int    `validate:"lte=100,gte=10"`
	Phone string `validate:"PhoneNumberCheck"`
	Email string `validate:"email"`
}

func main() {
	//r := gin.Default()

}

func PhoneNumberCheck(f1 validator.FieldLevel) bool {
	checkData := f1.Field().String()
	reg := regexp.MustCompile(`^1[0-9]{10,10}$`)
	return reg.MatchString(checkData)
}
